<?php

class Application_Form_Login extends Zend_Form {

    public function init() {

        $this->setMethod('post')
                ->setName('identification');

        //$this->getDecorator('dt')->setOption('tag', null);
        $this->setDisableLoadDefaultDecorators(true);
        //$this->removeDecorator('HtmlTag');

        $login = new Zend_Form_Element_Text('login');
        $login->setLabel('Utilisateur')
                ->setRequired(true)
                ->addFilters(array('StringTrim', 'StripTags'))
                ->addValidators(array(array('validator' => 'StringLength', 'options' => array(0, 20))))
                ->setAttribs(array('placeholder' => 'Utilisateur', 'class' => 'span4'))
                // supprime le decorateur
                ->getDecorator('label')->setOption('tag', null);
        //$login->removeDecorator('HtmlTag');

        $passwd = new Zend_Form_Element_Password('password');
        $passwd->setLabel('Mot de Passe')
                ->setRequired(true)
                ->addFilters(array('StringTrim', 'StripTags'))
                ->addValidators(array(array('validator' => 'StringLength', 'options' => array(0, 20))))
                ->setAttrib('class', 'span4')
                ->getDecorator('label')->setOption('tag', null);
        //$passwd->removeDecorator('HtmlTag');

        
        $remenber = new Zend_Form_Element_Checkbox('rememberMe');
        

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Connexion')
                ->setIgnore(true);
        $submit->removeDecorator('Label');
        $submit->removeDecorator('HtmlTag');


        // $submit->class = 'btn primary';
        $submit->setAttrib('class', 'btn primary');
        
        

        /*
          $cancel = new Zend_Form_Element_Reset('cancel');
          $cancel->setIgnore(true)
          ->setLabel('Annuler')
          ->setAttrib('onclick', 'window.location=\'' . $this->getView()->url(array('module' => '', 'controller' => 'index', 'action' => 'index')) . '\'');
          // $cancel->class = 'bnt';
          $cancel->setAttrib('class', 'btn');


          $reset = new Zend_Form_Element_Reset('reset');
          $reset->setDecorators(array(
          'ViewHelper'
          , array('HtmlTag', array('tag' => 'button', 'closeOnly' => true))));
          $this->addElement($reset);
         */

        $this->addElement($login);
        $this->addElement($passwd);
        $this->addElement($remenber);
        $this->addElement($submit);
        $this->submit->removeDecorator('label');

        /*
          $this->setElementDecorators(array(
          array('ViewHelper'),
          array('Errors'),
          array('Description'),
          array('Label'),
          array('HtmlTag', array('tag' => null, 'class' => 'clearfix')),
          ));
         */
        //$this->addElement($cancel);

        /*
         * fonctionne pas ici
          foreach ($this->getElements() as $element) {
          $element->getDecorator('label')->setTag(null);
          }
         */
        /*
          $this->setDecorators(array(
          array('ViewScript',
          array('viewScript' => 'index/authForm.phtml'))));
         */
    }

}

